﻿<%@ Page Language="C#" %>
<%@ Import Namespace="TalentPools.Model" %>
<%@ Import Namespace="TalentPools.BLL" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    private int PageSize = 20;
    private int pageIndex;

    public int PageIndex
    {
        get { return Convert.ToInt32(ViewState["pageIndex"]); }
        set { ViewState["pageIndex"] = value; }
    }
    private string workCata;

    public string WorkCata
    {
        get { return ViewState["workCata"].ToString(); }
        set { ViewState["workCata"] = value; }
    }
    private string workArea;

    public string WorkArea
    {
        get { return ViewState["workArea"].ToString(); }
        set { ViewState["workArea"] = value; }
    }
    private string workYear;

    public string WorkYear
    {
        get { return ViewState["workYear"].ToString(); }
        set { ViewState["workYear"] = value; }
    }
    private string keyword;

    public string Keyword
    {
        get { return ViewState["keyword"].ToString(); }
        set { ViewState["keyword"] = value; }
    }
    protected void btnsreach_Click(object sender, ImageClickEventArgs e)
    {
        WorkArea = "";
        WorkCata = "";
        WorkYear = "";
        Keyword = Request.Form["keyword"];
        if (Keyword == "输入行业/技能关键字")
        {
            Keyword = "";
        }
        if (ddlarea.SelectedIndex != 0)
        {
            WorkArea = ddlarea.SelectedItem.Value;
        }
        if(ddlprofession.SelectedIndex!=0)
        {
            WorkCata = ddlprofession.SelectedItem.Value;
        }

        if (drpyear.SelectedIndex != 0)
        {
            WorkYear = drpyear.SelectedItem.Value;
        }
        AspNetPager1.RecordCount = new SearchResumeManager().GetHuntCount(WorkCata, WorkArea, WorkYear, Keyword);
        DataBind(WorkCata, WorkArea, WorkYear, Keyword, 1);
    }
    private void DataBind(string workCata, string workArea, string workYear, string keyword, int pageIndex)
    {

        dlHunt.DataSource = new SearchResumeManager().GetHuntByPage(pageIndex, PageSize, workCata, workArea, workYear, keyword);
        dlHunt.DataBind();
        PageIndex = pageIndex;
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            CompanyClass.CheckQyUserLoginState();//检查企业用户是否登录
        }
    }

    protected void AspNetPager1_PageChanging(object src, PageChangingEventArgs e)
    {
        PageIndex = e.NewPageIndex;
        DataBind(WorkCata, WorkArea, WorkYear, Keyword, PageIndex);
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div style="width: 960px; height: auto; margin: 0px auto; background-color: #fff">
        <div id="head" style="width: 100%; height: 150px; background-color: #124409; border: 0px none;
            margin: 0px;">
            <strong>head</strong></div>
        <div id="left" style="float: left; width: 180px; height: 500px; border: 0px none;
            background-color: #557891">
            <strong>left</strong></div>
        <div id="right" style="float: right; width: 770px; margin-left: 10px; height: 500px;
            border: 0px none; background-color: #fff;">
            <div id="search" style="width:100%;height:100px; margin-top:5px; font:14px;background-color:#fff;text-align:left;">
            <div>
                <h3 class="form_head">
                    人才搜索</h3>
                <table style="text-align:left;">
                    <tr>
                        <td>
                            类别:
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlprofession" Width="100px" runat="server"></asp:DropDownList>
                            </td>
                        <td>
                            工作地点:
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlarea" runat="server" Width="100px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            工作年限:
                        </td>
                        <td style="text-align: left;">
                            <asp:DropDownList ID="drpyear" runat="server" Width="100px">
                                <asp:ListItem>不限</asp:ListItem>
                                <asp:ListItem>1年</asp:ListItem>
                                <asp:ListItem>2年</asp:ListItem>
                                <asp:ListItem>3年</asp:ListItem>
                                <asp:ListItem>4年以上</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td>
                            关 键 字:
                        </td>
                        <td>
                            <input maxlength="20" style="height: 20px; width: 149px;" type="text" name="keyword"
                                onblur="if(this.value=='') this.value='输入行业/技能关键字';" onfocus="if(this.value=='输入行业/技能关键字') this.value='';"
                                value="输入行业/技能关键字" />
                            <asp:ImageButton ID="btnsreach" runat="server" CssClass="txtBox" ImageUrl="~/img/17.gif"
                                OnClick="btnsreach_Click" />
                        </td>
                    </tr>
                </table>
            </div>
            </div>
            <div style="width:100%;height:30px; margin-top:5px; font:14px;background-color:blue; text-indent:一个单元; text-align:left;">
            最新优秀人才
            </div>
           
            <asp:DataList ID="dlHunt" runat="server" GridLines="Horizontal" 
                BorderStyle="Dashed" DataKeyField="Id">
                <HeaderStyle BorderStyle="Dashed" BorderWidth="1px" Font-Bold="True" Font-Size="13pt"
                    Height="20px" HorizontalAlign="Center" VerticalAlign="Middle" 
                    Width="770px" Wrap="False" />
                <HeaderTemplate>
                    <ul style="list-style: none; letter-spacing: 1px;">
                        <li style="float: left; display:block; width:80px;">编号</li>
                        <li style="float: left; display:block; width:110px;">性别</li>
                        <li style="float: left; display:block; width:110px;">工作时间</li>
                        <li style="float: left; display:block; width:120px;">意向行业</li>
                        <li style="float: left; display:block; width:120px;">意向职位</li>
                        <li style="float: left ;display:block; width:120px;">意向工作地</li>
                    </ul>
                </HeaderTemplate>
                <ItemStyle BorderStyle="Dashed" BorderWidth="1px" Font-Size="12pt" 
                    Height="18px" HorizontalAlign="Center" VerticalAlign="Bottom" Wrap="False" />
                <ItemTemplate>
                <ul style="list-style: none; letter-spacing: 1px;">
                        <li style="float: left; display:block; width:80px;"><a href="Persondetail.aspx?id="+<%#Eval("Id") %>><%#Eval("Id") %></a></li>
                        <li style="float: left; display:block; width:110px;"><%#Eval("sex") %></li>
                        <li style="float: left; display:block; width:110px;"><%#Eval("workYear") %></li>
                        <li style="float: left; display:block; width:120px;"><%#Eval("industry") %></li>
                        <li style="float: left; display:block; width:120px;"><%#Eval("profession") %></li>
                        <li style="float: left ;display:block; width:120px;"><%#Eval("area") %></li>
                    </ul>
                </ItemTemplate>
            </asp:DataList>
            <div style="text-align: right; width: 95%; line-height: 30px;">
                <webdiyer:AspNetPager ID="AspNetPager1" runat="server" FirstPageText="首页" LastPageText="最后一页"
                        NextPageText="下一页" PrevPageText="上一页" ShowBoxThreshold="20" PageSize="20" AlwaysShow="True"
                        OnPageChanging="AspNetPager1_PageChanging"> 
                </webdiyer:AspNetPager> 
                </div>
        </div>
    </div>
    </form>
</body>
</html>
